package org.wkg.lesson02;

public class Demo_205 {

    public static void main(String[] args) {
        Thread thread = new Thread(() -> {
            while (true) {
                System.out.println("hello thread..");
                try {
                    Thread.sleep(0);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });

        thread.setDaemon(true); //当main方法执行完毕以后，就会终止程序运行，虽然thead线程也随着终止
        thread.start();
        System.out.println(thread.getName() + " :isAlive: " + thread.isAlive());
        System.out.println("main方法执行完成");
    }
    
}
